package top.kaoshanji.p1ch04a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import top.kaoshanji.p1ch04a.support.ReflectiveResourceBundleControl;

import java.util.Locale;
import java.util.ResourceBundle;

/**
 * 代码清单 p1ch04a-09：自定义资料包实现的使用
 * author kaoshanji
 * ^_^
 * create time 2025/1/15 18:17
 */
public class ResourceBundleExample02 {

    private static final Logger logger = LogManager.getLogger(ResourceBundleExample02.class);

    public static void main(String[] args) {
        logger.info("...代码清单 p1ch04a-09：自定义资料包实现的使用...");

        String baseName = "top.kaoshanji.p1ch04a.support.ReflectiveMessages";
        ReflectiveResourceBundleControl control = new ReflectiveResourceBundleControl();
        ResourceBundle bundle = ResourceBundle.getBundle(baseName, Locale.CHINA, control);

        Object value = bundle.getObject("greet");
        logger.info("...value:{}...", value);

    }

}
